<?php

namespace Modules\Order\Models;

use Catch\Base\CatchModel as Model;
use Catch\Traits\DB\BaseOperate;
use Catch\Traits\DB\ScopeTrait;
use Catch\Traits\DB\Trans;
use Catch\Traits\DB\WithAttributes;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Laravel\Sanctum\HasApiTokens;
use Modules\Member\Models\Members;
use Modules\Shop\Models\Coupon;

class RefundRecord extends Model implements AuthenticatableContract
{
    use Authenticatable, HasApiTokens;

    protected $table = 'refund_record';
    public $timestamps = true;
    protected $fillable = [
        'id',
        'order_id',
        'user_id',
        'refund_money',
        'channel_type',
        'created_at',
        'updated_at',
        'deleted_at',
    ];
    public array $searchable = [
        'id',
        'order_id',
        'user_id',
        'refund_money',
        'channel_type',
        'created_at',
        'updated_at',
        'deleted_at',
    ];


    public function user()
    {
        return $this->belongsTo(Members::class, 'user_id')->select(['id', 'avatar', 'username', 'mobile']);
    }
    public function order()
    {
        return $this->belongsTo(Orders::class, 'order_id')->select(['id','waybill','weight','cal_weight','item_name']);
    }
}
